/**
 * autonavi.com Inc.
 * Copyright (c) 2004-${year} All Rights Reserved.
 */
package com.clm.po;

import com.jfinal.plugin.activerecord.Model;

import java.util.List;

/**
 * @author chong.song
 * @version 2014/6/23 23:04 chong.song
 */
public class User extends Model<User> {
    public static final User dao = new User();

    public int login(String name,String password){
        String sql = "select u.id from user u where u.name = ? and u.password = ?";
        List<User> users = dao.find(sql, name, password);
        if(users.size() > 0){
            return users.get(0).getInt("id");
        }else{
            return -1;
        }
    }
}
